package class101To110;

import java.io.*;

public class IndexTreeSingleAddIntervalQuery {
    public static int MAX_N = 500001;

    public static int[] tree = new int[MAX_N];

    public static int n, m, op;

    public static int lowBit(int x) {
        return x & (-x);
    }

    public static void add(int x, int v) {
        while (x <= n) {
            tree[x] += v;
            x += lowBit(x);
        }
    }

    public static int getSum(int i) {
        int ans = 0;
        while (i > 0) {
            ans += tree[i];
            i -= lowBit(i);
        }
        return ans;
    }

    public static int query(int l, int r) {
        return getSum(r) - getSum(l - 1);
    }

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StreamTokenizer in = new StreamTokenizer(br);
        PrintWriter out = new PrintWriter(System.out);
        while (in.nextToken() != StreamTokenizer.TT_EOF) {
            n = (int) in.nval;
            in.nextToken();
            m = (int) in.nval;
            for (int i = 1, v; i <= n; i++) {
                in.nextToken();
                v = (int) in.nval;
                add(i, v);
            }
            for (int i = 1, a, b; i <= m; i++) {
                in.nextToken();
                op = (int) in.nval;
                in.nextToken();
                a = (int) in.nval;
                in.nextToken();
                b = (int) in.nval;
                if (op == 1) {
                    add(a, b);
                } else {
                    out.println(query(a, b));
                }
            }
        }
        out.flush();
        out.close();
        br.close();
    }
}
